﻿
namespace Com.FastSearch.Utils
{
    /// <summary>
    /// Generic singleton class for managing factories.
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public sealed class SimpleFactoryManager<T> where T : class
    {
        private static T _instance;

        private SimpleFactoryManager()
        {
            // Singelon
        }

        static SimpleFactoryManager()
        {
            _instance = default(T);
        }

        /// <summary>
        /// The factory instance to be used for this type.
        /// </summary>
        public static T Factory
        {
            get
            {
                return _instance;
            }
            set
            {
                _instance = value;
            }
        }
    }
}
